package com.chenwy.example;


import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class LambdaTest {

    IView cardInfo(final String ta) {
        IView view = (Map model, HttpServletRequest request) -> {
            Map map = new HashMap();
            map.put("type", 700);
            map.put("fetchUrl", ta);
            return map;
        };
        return view;
    }

    public static void main(String[] args) throws UnsupportedEncodingException {
        Runnable run = () -> System.out.println("Run");
        List<Integer> list = Arrays.asList(1, 2, 3);
        list.forEach(System.out::println);
        System.out.println(new String(Base64.getUrlDecoder().decode("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9")));
        String str1 = "<a href=\"jjjjkkkkccc\" title='测试'></a><a title='xxx'></a>";
        //
        String reg1 = "\\s*href\\s*=\\s*['|\"](.*)['|\"]";//字符串中不包含a和d
        String reg2 = "\\s*href\\s*=\\s*['|\"]([^('|\"|>)]*)['|\"]";//[^('|\"|>)]代表不是'且不是"且不是>

        Pattern pattern1 = Pattern.compile(reg1);
        Pattern pattern2 = Pattern.compile(reg2);

        Matcher matcher1 = pattern1.matcher(str1);
        //最大的匹配
        if (matcher1.find()) {
            System.out.println("不含且关系>>" + matcher1.group(1));
        }
        System.out.println(matcher1.groupCount());

        Matcher matcher2 = pattern2.matcher(str1);
        if (matcher2.find()) {
            System.out.println("包含且关系>>" + matcher2.group(1));
        }

        //a145928e35e24b9d83677dabe9cd299e
//        System.out.println(UUID.randomUUID().toString());
    }
}
